package com.ruoyi.system.api.factory;
import com.ruoyi.system.api.RemoteAubitService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 模块化服务降级处理
 *
 * @author ruoyi
 */
@Component
public class RemoteAubitFallbackFactory implements FallbackFactory<RemoteAubitService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteAubitFallbackFactory.class);

    @Override
    public RemoteAubitService create(Throwable throwable)
    {
        log.error("模块化服务调用失败:{}", throwable.getMessage());
        return new RemoteAubitService()
        {
        //  为空则抛出 null
            @Override
            public List<?> selectAubitFieldbody_topid(String code, String source) {
                return null;
            }

            @Override
            public Long batchSave(List<?> aubitFieldbody, String source) {
                return null;
            }
        };
    }
}
